﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Interfaces
{
    #region Delegates

    public delegate void NewAbsoluteDataAvailableHandler(object sender, PositionEventArgs data);
    public delegate void NewCellDataAvailableHandler(object sender, PositionEventArgs data);
    public delegate void NewPairedDataAvailableHandler(object sender, IAbsoluteData absoluteData, IProximityData proximityData);
    public delegate void NewWifiDataAvailableHandler(object sender, PositionEventArgs data);
    public delegate void ContextChangedHandler(object sender);
    public delegate void ContextMatchesHandler(object sender, int id, short relevance);

    #endregion

    public interface IMiddleware : ICommonInterface
    {
        DateTime LastFixTime { get; }
        IAbsoluteData LastFixPosition { get; }

        event NewAbsoluteDataAvailableHandler NewAbsoluteDataAvailable;
        event NewCellDataAvailableHandler NewCellDataAvailable;
        event NewWifiDataAvailableHandler NewWifiDataAvailable;
        event NewPairedDataAvailableHandler NewPairedDataAvailable;
        event ContextChangedHandler ContextChanged;

        #region Marker methods

        int CreateTemplate(System.IO.Stream background, System.Drawing.Point imageOffset, System.Drawing.Point offset, string owner);

        int NewMarker(double latitude, double longitude, int proto_id, string text, System.Drawing.Bitmap image);
        bool MoveMarker(int marker_id, double latitude, double longitude);

        #endregion

        #region Event methods

        /// <summary>
        /// Creates a proximity-based event from the current proximity data
        /// </summary>
        /// <param name="eventHandler">Method to be called when the event occurs</param>
        /// <returns>true, if the creation was successful</returns>
        int CreateEvent(string description, short minRelevance, ContextMatchesHandler eventHandler, PositionOriginator[] originators);
        int CreateEvent(string description, short minRelevance, ContextMatchesHandler eventHandler, string[] members);
        bool MergeEvent(int id, string[] members);
        bool RemoveEvent(int id);
        string[] GetCurrentContext(PositionOriginator[] originators);

        #endregion
    }
}
